-
Notifications
You must be signed in to change notification settings - Fork 493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for http status code as a field #1574
Conversation
81589b6
to
37c8ea1
Compare
} else { | ||
err = errors.New("unknown error, use .captureResponse() to capture the HTTP response") | ||
} | ||
n.diag.Error("POST returned non 2xx status code", err, keyvalue.KV("code", strconv.Itoa(resp.StatusCode))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just now understood what you were saying here #1535 (comment) about making everything strings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one small comment. Other than that LGTM! 👍
services/httppost/service.go
Outdated
} else { | ||
err = errors.New("unknown error, use .captureResponse() to capture the HTTP response") | ||
} | ||
h.diag.WithContext(keyvalue.KV("code", strconv.Itoa(resp.StatusCode))).Error("POST returned non 2xx status code", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WithContext
returns a new diagnostic. Might be worth it to change the Error
method on Diagnostic
to
Error(msg string, err error, ctx ...keyvalue.T)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
efaff80
to
932d11f
Compare
Add support for http status code as a field
Fixes #1569